{% extends 'base/base.html' %}
{% load static %}

{#倒入样式#}
{% block EXTCSS %}
    <link rel="stylesheet" href="{% static 'market/css/market.css' %}">
{% endblock %}


{#    网页标题#}
{% block title %}
    <title>{{ title }}</title>
{% endblock %}


{% block content %}
    <div class="market">

        {#    侧边栏--热销榜  新鲜必尝#}
        <div class="type-slider">
            <ul>
                {% for foodtype in foodtypes %}
                    <li class="type-item">
                        <span></span>
                        <a href="{% url 'axf:market' foodtype.typeid childid 0 %}">{{ foodtype.typename }}</a>
                    </li>
                {% endfor %}
            </ul>
        </div>


        {#    顶部栏----  全部分类  综合排序#}
        <nav>
            <ul>
                {#                全部分类   按钮   #}
                <li id="allBt">
                    <span>全部分类   <b class="glyphicon glyphicon-chevron-up"></b></span>
                </li>
                {#                综合排序  按钮   #}
                <li id="sortBt">
                    <span>综合排序  <b class="glyphicon glyphicon-chevron-up"></b></span>
                </li>
            </ul>
        </nav>


        {#    显示商品等主体内容   #}
        <div class="main-content">
            <div class="content-wrapper">
                <ul>
                    {% for good in goodslist %}
                        <li>

                            {#   商品展示#}
                            <a href="#">
                                <img class="goods-img" src="{{ good.productimg }}" alt="">
                                <div class="goods-info">
                                    <p class="name">{{ good.productlongname }}</p>
                                    <p class="detailtag">
                                        {% if good.isxf %}
                                            <span class="xf">精选</span>
                                        {% endif %}
                                    </p>
                                    <p class="specifics">{{ good.specifics }}</p>
                                    <p class="price">
                                        <span class="now-price">¥{{ good.price }}</span>
                                        <span class="market-price">¥{{ good.marketprice }}</span>
                                    </p>
                                </div>
                            </a>


                            {#   按钮操作#}
                             <div class="bt-wrapper">
{#                             减号#}
                            <span class="glyphicon glyphicon-minus" goodsid="{{ good.id }}"></span>
                            <span class="num">
{#                            数量#}
                                {% for cart in carts %}
                                    {% if cart.goods_id == good.id %}
                                        {{ cart.number }}
                                    {% endif %}
                                {% endfor %}
                            </span>
{#                             加号#}
                            <span class="glyphicon glyphicon-plus" goodsid="{{ good.id }}"></span>
                        </div>

                        </li>
                    {% endfor %}
                </ul>
            </div>


            {#        分类中的子类#}
            {#        进口水果  国产水果    #}
            <div class="bounce-view type-view">
                <div class="bounce-wrapper">
                    {#           一个child就是一个对象    #}
                    {% for child in childlist %}
                        <a href="{% url 'axf:market' categoryid child.childid 0 %}">
                            {{ child.childname }}
                        </a>
                    {% endfor %}
                </div>
            </div>


            {#        分类中的排序#}
            {#        价格最低   价格最高   #}
            <div class="bounce-view sort-view">
                <div class="bounce-wrapper">
                    <a href="{% url 'axf:market' categoryid childid 0 %}">综合排序</a>
                    <a href="{% url 'axf:market' categoryid childid 1 %}">销量排序</a>
                    <a href="{% url 'axf:market' categoryid childid 2 %}">价格最低</a>
                    <a href="{% url 'axf:market' categoryid childid 3 %}">价格最高</a>
                </div>
            </div>

            {#        主体内容#}
        </div>
        {#    class = market  #}
    </div>

{% endblock %}



{# 添加的js #}
{% block EXTJS %}
    <script src="{% static 'market/js/market.js' %}"></script>
{% endblock %}

